package com.example.hybridmobiledemo.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.hybridmobiledemo.R;
import com.example.hybridmobiledemo.module.main.model.travel.bean.Tourism;

import java.util.List;

public class SmartTourismAdapter extends RecyclerView.Adapter<SmartTourismAdapter.ViewHolder> {
    private Context context;
    List<Tourism> list;
    public SmartTourismAdapter(Context context, List<Tourism> list){
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.tourism_item,parent,false);
        return new ViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        Tourism tourism = list.get(position);
        holder.image_tourism.setImageResource(R.drawable.def);
    }

    @Override
    public int getItemCount() {
        if(list != null){
            return list.size();
        }
        return 0;
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        ImageView image_tourism;
        TextView title_tourism,start_time_tourism,end_time_tourism;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);

            image_tourism = itemView.findViewById(R.id.image_tourism);
            title_tourism = itemView.findViewById(R.id.title_tourism);
            start_time_tourism = itemView.findViewById(R.id.start_time_tourism);
            end_time_tourism = itemView.findViewById(R.id.end_time_tourism);
        }
    }
}
